package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.ledger;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 台账文件
 */
@Data
@Entity
@Table(name = "t_business_ledger_task_file")
@org.hibernate.annotations.Table(appliesTo = "t_business_ledger_task_file", comment = "台账模板文件")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class BusinessLedgerTaskFile implements Serializable {
    private static final long serialVersionUID = 1681734153679666639L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(20) comment '台账文件id'")
    private Integer id;

    @Column(name = "business_ledger_task_id", columnDefinition = "int(20) comment '台账任务id'")
    private Integer businessLedgerTaskId;

    @Column(name = "file_template_id", columnDefinition = "int(20) comment '文件模板id'")
    private Integer fileTemplateId;

    @ApiModelProperty(value = "文件名称")
    @Column(name = "file_name", columnDefinition = "varchar(255) COMMENT '文件名称'")
    private String fileName;

    @ApiModelProperty(value = "工作事项类型")
    @Column(name = "work_item_type", columnDefinition = "varchar(40) COMMENT '工作事项类型数据字典 t_ledger_work_item_type'")
    private String workItemType;

    @ApiModelProperty(value = "文件类型")
    @Column(name = "type", columnDefinition = "varchar(40) COMMENT '文件类型 数据字典t_ledger_file_type'")
    private String type;

    @Column(name = "file_sort", columnDefinition = "int(20) comment '文件排序'")
    private Integer fileSort;

    @ApiModelProperty(value = "文件是否必填")
    @Column(name = "file_require", columnDefinition = "varchar(10) COMMENT '文件是否必填 字典yes_no Y必填 N非必填'")
    private String fileRequire;

    @ApiModelProperty(value = "文件是否实际收到")
    @Column(name = "file_actual_receive", columnDefinition = "varchar(10) COMMENT '文件是否实际收到 字典yes_no Y必填 N非必填'")
    private String fileActualReceive;

    @ApiModelProperty(value = "备注")
    @Column(name = "memo", columnDefinition = "varchar(255) COMMENT '备注'")
    private String memo;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @Column(name = "finish_id", columnDefinition = "int DEFAULT NULL COMMENT '完成人id'")
    @ApiModelProperty(value = "完成人id")
    private Long finishId;

    @ApiModelProperty(value = "完成人名称")
    @Column(name = "finish_user_name", columnDefinition = "varchar(100) COMMENT '备注'")
    private String finishUserName;

    @ApiModelProperty(value = "任务完成时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "finish_time", columnDefinition = "datetime comment '任务完成时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime finishTime;

    @ApiModelProperty(value = "台账任务文件工作值类型")
    @Column(name = "work_value_type", columnDefinition = "varchar(20) COMMENT '台账任务文件工作值类型,数据字典t_ledger_file_work_value_type'")
    private String workValueType;

    @ApiModelProperty(value = "工作值")
    @Column(name = "work_value", columnDefinition = "varchar(60) COMMENT '工作值'")
    private String workValue;
}
